use strict;
use Net::POP3;
unless (@ARGV == 3) { die "Usage: $0 host username password\n" };
my $host = $ARGV[0];
my $username = $ARGV[1];
my $password = $ARGV[2];
print "username is $username, host is $host, password is $password\n";
# ($host $username, $password) = @ARGV;
    # Constructors
#     my $pop = Net::POP3->new('$host');
     my $pop = Net::POP3->new($host, Timeout => 60) || die "Can't create new POP3: ";
 
     if ($pop->login($username, $password) > 0) {
       my $msgnums = $pop->list; # hashref of msgnum => size
       foreach my $msgnum (keys %$msgnums) {
         my $msg = $pop->get($msgnum);
         print @$msg;
         $pop->delete($msgnum);
       }
     } else {
	     print "no new message\n"
	}
 
     $pop->quit;

